{% load future wenlincms_tags wlcore_tags report_tags %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="renderer" content="webkit">
    <meta name="robots" content="none">
    <title>{{ el_post.ENTNAME }} 企业图谱 | {{ sitesettings.website_name }}</title>
    {% block style %}
        <link rel="stylesheet" href="{{ STATIC_URL }}{{ "element/report/tupu/css/tupu.css"|file_time_stamp }}"/>
        <style>
            .mainbox {
                width: 100%;
                overflow: hidden;
                margin: 0 auto;
            }
            .samlltitle:before {
                content: " ";
                display: block;
                position: relative;
                width: 0;
                height: 0;
                border: 5px #28a7e9 solid;
                left: 0;
                top: 20px;
            }
            .samlltitle {
                border-bottom: 1px solid #28a7e9;
                padding: 10px 0;
                margin: 0;
                font-size: 17px;
                font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
            }
            .changebtn {
                display: inline-block;
                transition: all 0.3s ease;
                background: #fff;
                border: 1px solid #28a7e9;
                color: #28a7e9;
                text-align: center;
                font-size: 14px;
                font-weight: normal;
                padding: 5px 10px;
                margin-left: 20px;
                border-radius: 3px;
            }
            .changebtn:hover, .btnactive {
                cursor: pointer;
                background: #28a7e9;
                color: #fff;
            }
            {% if isiframe %}
                @media only screen and (min-width: 1200px) {
                    #echartforce, #echartcircle {
                        height: 600px;
                    }
                }
                @media only screen and (max-width: 1200px) {
                    #echartforce, #echartcircle {
                        height: 500px;
                    }
                }
            {% else %}
                @media only screen and (min-width: 1200px) {
                    #echartforce, #echartcircle {
                        height: 850px;
                    }
                }
                @media only screen and (max-width: 1200px) {
                    #echartforce, #echartcircle {
                        height: 550px;
                    }
                }
            {% endif %}
            #d3circletree path.arc {
                cursor: move;
                fill: #fff;
            }
            #d3circletree .link {
                fill: none;
                stroke: #ccc;
                stroke-width: 1.5px;
            }
            {% if dstyle == 2 or dstyle == 3 %}
                #companyrelated, #d3treechart {
                    display: none;
                }
            {% endif %}
        </style>
    {% endblock %}
</head>
<body>
{% block mainbox %}
    <div class="mainbox">
        <h4 class="samlltitle">&nbsp;&nbsp;&nbsp;企业图谱{% if not isiframe %} - {{ el_post.ENTNAME }}{% endif %}
            {% if dstyle == 2 or dstyle == 3 %}
                <span class="changebtn d3btn" onclick="showchart('d3circletree',this)">发散图</span>
                <span class="changebtn d3btn" onclick="showchart('d3treechart',this)">树图</span>
            {% endif %}
            {% if dstyle == 1 or dstyle == 3 %}
                <span class="changebtn ecbtn" onclick="showchart('echartforce',this)">力导向图</span>
                <span class="changebtn ecbtn" onclick="showchart('echartcircle',this)">弦图</span>
            {% endif %}
            {% if dstyle == 2 or dstyle == 3 %}
                <span class="changebtn d3btn" onclick="showchart('d3treemap',this)">股东成分分析</span>
            {% endif %}
        </h4>

        <div id="saasloading">
            <div class="spinner">
                <div class="bounce1"></div>
                <div class="bounce2"></div>
                <div class="bounce3"></div>
            </div>
        </div>
        {% if dstyle == 2 or dstyle == 3 %}
            <div id="d3circletree" class="chartbox">
                <div class="showtextbox">
                    <span class="checklabel">显示名称</span>
                    <span class="ui-check" id="ui-check-close">
                        <input id="check" type="checkbox"/>
                        <label for="check"></label>
                    </span>
                    <span class="ui-check" id="ui-check-open">
                        <input id="check1" type="checkbox"/>
                        <label for="check1"></label>
                    </span>
                </div>
                {% include "element/saas/related/d3_filter.html" %}
                <div id="panelinfo1"></div>
            </div>
            <div id="d3treechart" class="chartbox">
                    <div class="showtextbox">
                    <span class="checklabel">显示名称</span>
                    <span class="ui-check" id="ui-check-close1">
                        <input id="check3" type="checkbox"/>
                        <label for="check3"></label>
                    </span>
                    <span class="ui-check" id="ui-check-open1">
                        <input id="check4" type="checkbox"/>
                        <label for="check4"></label>
                    </span>
                </div>
                {% include "element/saas/related/d3_filter.html" %}
                <div id="panelinfo2"></div>
            </div>
        {% endif %}
        {% if dstyle == 1 or dstyle == 3 %}
            <div id="echartforce" class="chartbox" style="min-width:900px; padding:15px;"></div>
            <div id="echartcircle" class="chartbox" style="min-width:900px; padding:15px;"></div>
        {% endif %}
        <div id="d3treemap" class="chartbox" style="min-width:900px; padding:15px;"></div>
    </div>
{% endblock %}

<script src="{{ STATIC_URL }}opensource/amazeui-2.4/js/jquery.min.js"></script>

{% if dstyle == 1 or dstyle == 3 %}
    <script src="{{ STATIC_URL }}opensource/echarts-3.3/echarts.min.js"></script>
    <script src="{{ STATIC_URL }}opensource/echarts-3.3/dataTool.min.js"></script>
    <script src="{{ STATIC_URL }}{{ "element/report/tupu/js/tp_echarts.js"|file_time_stamp }}"></script>
{% endif %}

{% if dstyle == 2 or dstyle == 3 %}
    <script src="{{ STATIC_URL }}opensource/modernizr.js"></script>
    <script src="{{ STATIC_URL }}opensource/d3/d3.v3.js"></script>
    <script src="{{ STATIC_URL }}{{ "element/report/tupu/js/tp_d3.js"|file_time_stamp }}"></script>
{% endif %}

<script src="{{ STATIC_URL }}{{ "element/report/tupu/js/tp.js"|file_time_stamp }}"></script>
<script>
    var testdata = {
        "name": "山西元康汽车商务有限公司",
        "tags": "0",
        "id": "372e7519-294e-42c6-8bdb-f9d9bd2842ec",
        "eid": "e4410238",
        "children": [{
            "name": "刘照国",
            "tags": "2",
            "children": [{
                "name": "山西联翔机电设备有限公司",
                "tags": "1",
                "relation": "投资(14.0%)",
                "eid": "e4403565",
                "id": "c4c9b4e7-87d9-4f01-8ac2-ac2693552782",
                "size": "5"
            }, {
                "name": "山西东驰实业有限公司",
                "tags": "1",
                "relation": "投资(None%)",
                "eid": "e3977488",
                "id": "f65dce69-3883-4891-8deb-bb35d62ffe8b",
                "size": "5"
            }, {
                "name": "山西东联汽车销售有限公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4320196",
                "id": "6e068bdd-54bb-41ef-8c75-d5d1bb37c47a",
                "size": "5"
            }, {
                "name": "第一汽车集团山西联合贸易公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4387689",
                "id": "f802d5ea-b156-472f-b4d8-8f57c3f69161",
                "size": "5"
            }, {
                "name": "山西物产跃进汽车销售有限公司",
                "tags": "1",
                "relation": "董事",
                "eid": "e4393326",
                "id": "97be5d2e-7fdb-41f0-bb8e-702304af3f85",
                "size": "5"
            }, {
                "name": "山西三晋汽车贸易有限公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4293654",
                "id": "e5a153a1-ceaa-4e07-a0a1-dc9b182d8597",
                "size": "5"
            }, {
                "name": "山西省机电设备总公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4384852",
                "id": "c5ca7004-7eea-4737-b865-2671b30adf59",
                "size": "5"
            }],
            "relation": "法人",
            "eid": "p19368277",
            "id": "9a241c9f-bf1e-4530-bf5b-908d52c805d7",
            "size": "5"
        }, {
            "name": "杜欣春",
            "tags": "2",
            {#            "children": [],#}
            "relation": "监事",
            "eid": "p35198003",
            "id": "587eeac8-233e-40da-add7-45991bf76c0d",
            "size": "5"
        }, {
            "name": "夏明",
            "tags": "2",
            "children": [{
                "name": "山西物产轮胎橡胶有限公司",
                "tags": "1",
                "relation": "董事",
                "eid": "e4325416",
                "id": "0ae49486-d065-49af-8da0-73974b3997c7",
                "size": "5"
            }, {
                "name": "山西机电通用产品有限责任公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4469784",
                "id": "d8367f60-bfa8-4b64-aca3-5021d6fc68ab",
                "size": "5"
            }, {
                "name": "太原通顺翔商贸有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4401888",
                "id": "3f2b4cbf-17f6-4a81-af3d-6ed41bd077ba",
                "size": "5"
            }],
            "relation": "监事",
            "eid": "p11487973",
            "id": "a28a75cc-aab5-43a1-b294-6ba255242bd0",
            "size": "5"
        }, {
            "name": "吕凤鸣",
            "tags": "2",
            "children": [{
                "name": "山西新大洋汽车销售有限公司",
                "tags": "1",
                "relation": "投资(2.0%)",
                "eid": "e4391228",
                "id": "2e7334da-5707-4cd6-ad0e-5540dbb59e27",
                "size": "5"
            }, {
                "name": "山西物产一汽汽车销售有限公司",
                "tags": "1",
                "relation": "董事",
                "eid": "e4392512",
                "id": "85a42e72-04e8-4af6-91d0-573f78f9749d",
                "size": "5"
            }, {
                "name": "海南万锡房地产开发有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e35416894",
                "id": "c0f3c1cf-5772-43e9-b108-298c891a5c4a",
                "size": "5"
            }, {
                "name": "太原市巨石商贸有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4409682",
                "id": "895e6c7c-5718-48ed-ae44-812c1d016a73",
                "size": "5"
            }, {
                "name": "山西兰翔空调电器贸易有限公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4123584",
                "id": "3e8993a7-94cd-4604-81b7-bfa790d82e77",
                "size": "5"
            }],
            "relation": "董事, 股东(20.0%)",
            "eid": "p10017254",
            "id": "509eb558-4197-47e2-aece-b31dcdf0e19f",
            "size": "5"
        }, {
            "name": "任俊茂",
            "tags": "2",
            "children": [{
                "name": "山西晋菱汽车销售服务有限公司",
                "tags": "1",
                "relation": "投资(5.0%)",
                "eid": "e4127316",
                "id": "278003d7-29b6-4542-8d2a-afc4090b74ff",
                "size": "5"
            }, {
                "name": "山西长风华盛汽车贸易有限公司",
                "tags": "1",
                "relation": "投资(78.0%)",
                "eid": "e4360294",
                "id": "a1735c67-0f33-4267-88a0-a32c418a0031",
                "size": "5"
            }, {
                "name": "山西华阳汽车销售服务有限公司",
                "tags": "1",
                "relation": "投资(14.5455%)",
                "eid": "e4295863",
                "id": "7f4f8d18-184f-40b2-b9de-f9ebe069dd27",
                "size": "5"
            }, {
                "name": "山西隆翔汽车销售服务有限公司",
                "tags": "1",
                "relation": "投资(22.0%)",
                "eid": "e4277389",
                "id": "eb4b1d92-ddf8-47bf-bdf1-0392212d36f7",
                "size": "5"
            }],
            "relation": "董事",
            "eid": "p23033577",
            "id": "4acc3fd9-e384-4d86-8ad9-4aa54694660c",
            "size": "5"
        }, {
            "name": "贾原喜",
            "tags": "2",
            "children": [{
                "name": "山西元丰汽车贸易有限责任公司",
                "tags": "1",
                "relation": "投资(None%)",
                "eid": "e4325225",
                "id": "ea577f05-478f-46e3-b324-2ba03a1df1b3",
                "size": "5"
            }, {
                "name": "长治市长瑞商贸有限公司",
                "tags": "1",
                "relation": "投资(30.0%)",
                "eid": "e4561069",
                "id": "255fb669-55c7-4f33-81eb-112a40701843",
                "size": "5"
            }, {
                "name": "大同市瑞同轴承销售有限公司",
                "tags": "1",
                "relation": "投资(40.0%)",
                "eid": "e4452720",
                "id": "9a751654-7817-4ae2-8042-940e61e16ff8",
                "size": "5"
            }, {
                "name": "山西诚瑞商贸有限公司",
                "tags": "1",
                "relation": "投资(40.0%)",
                "eid": "e4359168",
                "id": "2ada93d1-06ed-4e0c-8db5-81295938d7f9",
                "size": "5"
            }, {
                "name": "山西轻骑摩托车销售有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4392269",
                "id": "84ff34f0-cb7d-45ea-9844-0076d6447ec6",
                "size": "5"
            }, {
                "name": "山西机电摩托车商贸有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4391858",
                "id": "5350a517-e9d7-4c65-9df5-457ca61b8d73",
                "size": "5"
            }, {
                "name": "山西承翔机电轴承有限公司",
                "tags": "1",
                "relation": "董事长",
                "eid": "e4147563",
                "id": "c8c3182b-0ff7-4706-ac92-8135b82678ab",
                "size": "5"
            }],
            "relation": "监事",
            "eid": "p10002447",
            "id": "89f332a0-61f2-4709-812f-c186b63add03",
            "size": "5"
        }, {
            "name": "张凯兵",
            "tags": "2",
            {#            "children": [],#}
            "relation": "董事",
            "eid": "p35198355",
            "id": "baacb89f-147d-4760-ab7d-fef64104caf3",
            "size": "5"
        }, {
            "name": "李拉曼",
            "tags": "2",
            "children": [{
                "name": "山西物产五菱汽车销售有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4341189",
                "id": "48212f7c-86ad-4f8e-a7c5-cecd79bff904",
                "size": "5"
            }, {
                "name": "山西物产高新技术开发有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4393282",
                "id": "7deb8a41-6459-4e39-be9a-366c2577b87c",
                "size": "5"
            }, {
                "name": "山西晋缆物资有限公司",
                "tags": "1",
                "relation": "监事",
                "eid": "e4399819",
                "id": "a37dbf4f-edd8-4d37-b442-a4a7159c03c0",
                "size": "5"
            }],
            "relation": "董事, 股东(20.0%)",
            "eid": "p14835511",
            "id": "2c06ba6d-d7d2-4ce6-94e0-68e5d7443207",
            "size": "5"
        }],
        "size": "6"
    };
    var ecajax = function () {
        $.ajax({
            url: "{{ el_post.get_report_url }}tupu_xml/",
            success: function (data) {
                echartdata(data, "echartforce");
                echartdata(data, "echartcircle");
                $("#saasloading").hide();
            },
            error: function () {
                console.log("系统错误，联系管理员！");
            }
        });
    };
    var d3ajax = function () {
        $.ajax({
            url: "{{ el_post.get_report_url }}".replace("/report/", "/saas/tupu_json/"),
            success: function (data) {
                d3tree1(data);
                d3tree2(data);
                showtext("ui-check-open", "ui-check-close");
                showtext("ui-check-open1", "ui-check-close1");
                d3tree3(testdata);
                $("#saasloading").hide();
            },
            error: function () {
                console.log("系统错误，联系管理员！");
            }
        });
    };
    $(".changebtn:first-child").click();
    function showchart(id, _this) {
        var $this = $(_this);
        if (!$this.hasClass("btnactive")) {
            $(".changebtn").removeClass("btnactive");
            $(".chartbox").hide();
            $(_this).addClass("btnactive");
            $("#" + id).show();
            if ($this.hasClass("d3btn")) {
                d3ajax();
            }
            if ($this.hasClass("ecbtn")) {
                ecajax();
            }
        }
    }
    $("#d3treechart .showbtn").click(function () {
        typeToggle("d3treechart");
    });
    $("#d3circletree .showbtn").click(function () {
        typeToggle("d3circletree");
    });
    function typeToggle(id) {
        var parent = $("#" + id),
                btn = parent.find(".showbtn"),
                maintext = parent.find(".panel-body"),
                btnname = btn.attr("name");
        if (btnname == 0) {
            btn.html("展开  ↓");
            maintext.hide();
            btn.attr("name", "1");
        } else {
            btn.html("收起  ↑");
            maintext.show();
            btn.attr("name", "0")
        }
    }
    $("#ui-check-open").click(function () {
        showtext("ui-check-open", "ui-check-close");
    });
    $("#ui-check-open1").click(function () {
        showtext("ui-check-open1", "ui-check-close1");
    });
    $("#ui-check-close").click(function () {
        hidetext("ui-check-close", "ui-check-open");
    });
    $("#ui-check-close1").click(function () {
        hidetext("ui-check-close1", "ui-check-open1");
    });
</script>
</body>
</html>
